home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 12
/
Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso
/
Aminet
/
misc
/
math
/
prime_2.lha
/
prime_2.readme
< prev
Wrap
Text File
|
1996-03-09
|
3KB
|
71 lines
author: Gerd Wieczorek
SMail: Berliner Str.1
14959 Trebbin
BRD
EMail: gwieifjc@sp.zrz.tu-berlin.de
(1x wöchentlich kontrolliert)
program: Prime (version 2)
This short program calculates all primnumbers until a given end is reached
and writes them to the shell. The output can be redirected in a file with
a normal "> file".
Prime uses the algorithm of Eratosthenes ( Sieve of ~ ). It requires a
processor >= 68020, if your Amiga contains a fpu you can use the special
version. This means: prime_020 for Amiga without fpu, prime_020_881 for
Amiga with fpu.
Prime is only usable from a shell.
It uses the folloing options:
Prime MAX/A/N,BigBuffer=BB/S,NOOUTPUT=NO/S
Meanings of the options:
MAX - search for primnumbers until this number is reached
BIGBUFFER - prime uses a bigger internal buffer for the output
normal: 8 KByte, with BB: 256 KByte
NOOUTPUT - prime produces no output, its only useful for measering the
time of the calculation-loop
The command can be interrupted with CTRL-C. But be careful: using a big
buffer without redirection could take a long time, before the output stops !
( because the entire buffer is written via DOS-Write )
Time needed by prime:
On my Amiga (A500, 68030/14MHz, 68882/20MHz, 4/1 MB) the sequence
"Prime MAX BIGBUFFER >ram:prime.txt" needs these times:
MAX 10000 50000 100000 500000 1000000 2000000 3000000 4000000
time (s) 0.2 0.7 1.2 5.5 10.7 21.5 31.9 43.0
The times for the old version (prime.lha) were to small - by a factor of 3.
So here are the correct values:
MAX 10000 50000 100000 500000 1000000 2000000 3000000 4000000
time (s) 0.7 2.3 4.4 19.4 37.0 70.0 100.0 130.0
As you could see, prime (v2) is roughly 3 times faster. This was made
possible by the replacement of the RawDoFmt-call with a self programmed
int->ascii conversion-routine. All other things remained.
Prime works with VMM and uses the virtual memory. It needs ca. MAX/8 in Kbyte
plus the output-buffer of 8 or 256 Kbyte.
Because of the heavy memory access virtual memory slows down the calculation
significantly. The use of the processor cache is helpful, it speeds up the
program by 35% with my 68030. The length of the written textfile can be esti-
mated with ca. MAX bytes for MAX<100000, else roughly 0.6*MAX bytes.
If you have any questions, remarks, suggestions or bug reports please
let me know. If you have no remarks, then you should drop me a little
e-mail with your speed-results from prime.
Disclaimer:
The entire risk as to the use of the program and the information presented
is assumed by the user. In no event will I be liable for any damage resulting
from any claim arising of the use of the program or the information presented
herein, even if I have been advised of the possibilities of such damages.
If anyone wants to include prime into another archive, he should send me
an e-mail before.